<?php

namespace app\common\lib;

class ChooseClass
{
    public static function smsClassStat()
    {
        // 返回各个sms类库
        return [
            'ali' => 'app\common\lib\sms\AliSms',
            'baidu' => 'app\common\lib\sms\BaiDuSms',
            'jd' => 'app\common\lib\sms\JdSms'
        ];
    }

    public static function initClass($type, $classs, $param = [], $needInstance = false)
    {
        if (!array_key_exists($type, $classs)) {
            return false;
        }
        $className = $classs[$type];
        return $needInstance == true ? (new \ReflectionClass($className))->newInstanceArgs($param) : $className;
    }
}
